package com.lhd.service;

import com.lhd.dao.UserDao;
import com.lhd.po.User;
import com.lhd.util.MD5Utils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * Created by limi on 2017/10/15.
 */
@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private UserDao userDao;

    @Override
    public User checkUser(String username, String password) {
        String pass = MD5Utils.code(password);
        User user = userDao.findByUsernameAndPassword(username, pass);
        return user;
    }

    @Override
    public User getUserById(Long id) {
        return userDao.getUserById(id);
    }
}
